package pw.goyd.game.logic;

import pw.goyd.game.model.Card;
import pw.goyd.protocol.core.Serializer;
import pw.goyd.subscribe.PlayerCustomer;

import java.util.List;

/**
 * 显示所有玩家手牌
 *
 * @author StanWind
 */
public class ShowCardsResponse extends Serializer {
    private List<PlayerCustomer> pl;

    public List<PlayerCustomer> getPl() {
        return pl;
    }

    public void setPl(List<PlayerCustomer> pl) {
        this.pl = pl;
    }

    @Override
    protected void read() {

    }

    @Override
    protected void write() {
        //若干个玩家信息(accountID + 手牌权值(没牛牛一牛二...) + 五张手牌信息(weight + suit))
        for (PlayerCustomer p : pl) {
            writeString(p.getAccount_id());
            writeByte((byte) p.getResType().ordinal());
            List<Card> cl = p.getCards();
            for (Card c : cl) {
                writeByte((byte) c.getSuit());
                writeByte((byte) c.getWeight());
            }

        }
    }

}
